package com.mall.mall.product.config;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@Configuration
@EnableTransactionManagement
@MapperScan("com.mall.mall.product.dao")
public class MybatisConfig {

    @Bean
    public PaginationInterceptor paginationInnerInterceptor(){
        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
        //设置请求的页面最大页后操作， true 调回首页, false 继续请求 默认 false
        paginationInterceptor.setOverflow(true);
        //设置最大单页限制数量, 默认 1000 条
        paginationInterceptor.setLimit(1000);

        return  paginationInterceptor;
    }
}
